/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */
#ifndef __COMPONENT_CONTROL_H__
#define __COMPONENT_CONTROL_H__

#include "WidgetBase.h"
#include "TransformControl.h"
#include "TerrainControl.h"

namespace PQBuilder
{
	class ComponentUI
	{
	public:
		inline virtual void setupUI(QWidget* widget, PQEngine::Component* component){}
		//when component's property changed
		inline virtual void OnPropertyChange(PQEngine::Component* component){}
	};

	class ComponentControl : 
		public WidgetBase
	{
	public:
		ComponentControl(PQEngine::Component* component,QWidget *parent = 0);
		~ComponentControl();

		inline QString getComponentText()
		{
			return _text;
		}

	private:
		void setupUI();

		void setupTransformUI(PQEngine::Component* component);
		void setupMeshUI(PQEngine::Component* component);
		void setupScriptUI(PQEngine::Component* component);
		void setupRigidBodyUI(PQEngine::Component* component);
		void setupBoxColliderUI(PQEngine::Component* component);
		void setupPlaneColliderUI(PQEngine::Component* component);
		void setupSphereColliderUI(PQEngine::Component* component);
		void setupTerrainUI(PQEngine::Component* component);

	private:
		PQEngine::Component* _component;
		ComponentUI* _ui;
		QString _text;
	};

	class TransformUI :
		public ComponentUI
	{
	public:
		void setupUI(QWidget* widget, PQEngine::Component* cpnt);
	private:
		TransformControl* _control;
	};

	class MeshUI :
		public ComponentUI
	{
	public:
		inline virtual void setupUI(QWidget* widget, PQEngine::Component* component){}
	};

	class ScriptUI :
		public ComponentUI
	{
	public:
		inline virtual void setupUI(QWidget* widget, PQEngine::Component* component){}
	};

	class RigidBodyUI :
		public ComponentUI
	{
	public:
		inline virtual void setupUI(QWidget* widget, PQEngine::Component* component){}
	};

	class BoxColliderUI :
		public ComponentUI
	{
	public:
		inline virtual void setupUI(QWidget* widget, PQEngine::Component* component){}
	};

	class PlaneColliderUI :
		public ComponentUI
	{
	public:
		inline virtual void setupUI(QWidget* widget, PQEngine::Component* component){}
	};

	class SphereColliderUI :
		public ComponentUI
	{
	public:
		inline virtual void setupUI(QWidget* widget, PQEngine::Component* component){}
	};

	class TerrainUI :
		public ComponentUI
	{
	public:
		void setupUI(QWidget* widget, PQEngine::Component* component);
	private:
		TerrainControl* _control;
	};


}

#endif
